﻿using System;
using System.Globalization;
using System.Threading;
using Microsoft.ComplexEventProcessing;
using Microsoft.ComplexEventProcessing.Adapters;

namespace $Namespace$
{


    public class $PointClassName$ : PointInputAdapter
    {

    private $ConfigClassName$ _configInfo;
        /// <summary>
        /// Initializes a new instance of the $PointClassName$ class.
        /// </summary>
        /// <param name="configInfo">Configuration structure provided by the Factory.</param>
        /// <param name="eventType">Represents the actual event type that will be passed into this
        /// constructor from the query binding via the adapter factory class.</param>
        public $PointClassName$($ConfigClassName$ configInfo, CepEventType eventType)
        {
            _configInfo = configInfo;
        }

        /// <summary>
        /// Start() is called when the engine wants to let the adapter start producing events.
        /// This method is called on a threadpool thread, which should be released as soon as possible.
        /// </summary>
        public override void Start()
        {
            new Thread(this.ProduceEvents).Start();
        }

        /// <summary>
        /// Resume() is called when the engine is able to receive further events after having pushed
        /// back on an Enqueue call. Resume() will only be called after the adapter called Ready().
        /// This method is called on a threadpool thread, which should be released as soon as possible.
        /// </summary>
        public override void Resume()
        {
            new Thread(this.ProduceEvents).Start();
        }

        /// <summary>
        /// Notifies the adapter to stop as a result of stopping or aborting the query.
        /// You should clean up and release any resources when Stop() is called.
        /// </summary>
        public override void Stop()
        {
            base.Stop();
            //Make sure that you call stopped when you are fully stopped.
            //Until Stopped() is called, the server will not stop the adapter.
            //This can cause hanging, especially on exit.
            this.Stopped();
        }

        /// <summary>
        /// Default Dispose from the base class.
        /// </summary>
        /// <param name="disposing">Indicates whether to free both managed and unmanaged resources.</param>
        protected override void Dispose(bool disposing)
        {
            //Any required disposal
            base.Dispose(disposing);
        }

        /// <summary>
        /// Main driver to read events from source and enqueue them.
        /// </summary>
        private void ProduceEvents()
        {
           
        }

    }
}